<template>
    <div id="qrcode">
      <div class="tuigua">{{msg}}</div>
    </div>
</template>

<script>
//引入qrcode
import QRCode from 'qrcodejs2'
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg:'网页二维码'
    }
  },
  mounted(){
     this.qrcode();
  },
  methods:{
    qrcode(){
      let qrcode=new QRCode('qrcode',{
        logo:'../assets/logo.png',
        width:132,
        height:132,
        text:'https://zxk0nly1.gitee.io/html-css-example/',//二维码地址
        colorDark: "#000",
        colorLight: "#fff",
        typeNumber:4,
        correctLevel:QRCode.CorrectLevel.H
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#qrcode{
  display: inline-block;
  position: relative;
}
#qrcode img{
  width: 132px;
  height: 132px; 
  background-color: #fff;
  padding: 6px;
}
.tuigua{
  position: absolute;
  width: 132px;
  margin-top: -32px;
}
</style>